#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

//int main() {
//	int arr[] = {1,2,3,4,5,7,8,9};
//	int x = 0;
//	int i = 0;
//	int sz = sizeof(arr) / sizeof(arr[0]);
//	for ( i = 0; i < sz; i++) {
//		x ^= arr[i];
//	}
//	for ( i = 0; i <= sz + 1; i++) {
//		x ^= i;
//	}
//	printf("%d ",x);
//	return 0;
//}

//int main() {
//	int* p = NULL;
//	if (p == NULL) {
//		perror("malloc fail");
//		
//	}
//	return 0;
//}
#include "SeqList.h"
void SeqListTest1() {
	SeqList s;
	SLInit(&s);
	SLPushBack(&s, 1);
	SLPushBack(&s, 2);
	SLPushBack(&s, 3);
	SLPushBack(&s, 4);
	SLPushBack(&s, 5);
	SLPushBack(&s, 6);
	SLPushBack(&s, 7);
	SLPushBack(&s, 8);
	SLPushBack(&s, 9);
	SLPushBack(&s, 10);

	SLPrint(&s);
	SLDestroy(&s);
}
void SeqListTest2() {
	SeqList s;
	SLInit(&s);
	SLPushBack(&s, 1);
	SLPushBack(&s, 2);
	SLPushBack(&s, 3);
	SLPushBack(&s, 4);
	SLPushFront(&s, 5);
	SLPushFront(&s, 6);
	SLPushFront(&s, 7);
	SLPushFront(&s, 8);
	SLPushFront(&s, 9);
	SLPushFront(&s, 10);

	SLPrint(&s);
	SLDestroy(&s);
}
void SeqListTest3() {
	SeqList s;
	SLInit(&s);
	SLPushBack(&s, 1);
	SLPushBack(&s, 2);
	SLPushBack(&s, 3);
	SLPushBack(&s, 4);
	
	SLPrint(&s);
	SLPopBack(&s);
	SLPopBack(&s);
	SLPopBack(&s);
	SLPrint(&s);
	SLDestroy(&s);
}
void SeqListTest4() {
	SeqList s;
	SLInit(&s);
	SLPushBack(&s, 1);
	SLPushBack(&s, 2);
	SLPushBack(&s, 3);
	SLPushBack(&s, 4);
	SLInsert(&s, 2, 30);
	SLPrint(&s);
	SLDestroy(&s);
}
void SeqListTest5() {
	SeqList s;
	SLInit(&s);
	SLPushBack(&s, 1);
	SLPushBack(&s, 2);
	SLPushBack(&s, 3);
	SLPushBack(&s, 4);
	SLInsert(&s, 2, 30);
	SLPrint(&s);
	SLErase(&s, 2);
	SLPrint(&s);
	SLDestroy(&s);
}
void SeqListTest6() {
	SeqList s;
	SLInit(&s);
	SLPushBack(&s, 1);
	SLPushBack(&s, 2);
	SLPushBack(&s, 3);
	SLPushBack(&s, 4);
	//SLInsert(&s, 2, 30);
	//SLPrint(&s);
	//SLErase(&s, 2);
	int pos=SLFind(&s, 4);
	if (pos != -1) {
		SLErase(&s, pos);
	}
	SLPrint(&s);
	SLDestroy(&s);
}
int main() {
	SeqListTest6();
	return 0;
}